package com.SB.dao.impl;

import com.SB.dao.LoginDao;
import com.SB.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;


public class LoginDaoImpl implements LoginDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;
    String SQL;

    @Override
    public List<User> selectuser(String username, String password) {
        SQL = "SELECT * FROM `user` WHERE username = '?' and PASSWORD = '?'";
        return jdbcTemplate.query(SQL, new BeanPropertyRowMapper(User.class), new String[]{username, password});
    }
}
